<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:s="http://jboss.com/products/seam/taglib"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:rich="http://richfaces.org/rich"
	xmlns:a="http://richfaces.org/a4j">

   
	<a:form ajaxSubmit="true" id="departmanListForm">
		<a:outputPanel id="departmanReturnValue">
			<rich:panel rendered="#{departmanDao.departmanList.size()!=0}"
				id="departmanPanelList">
				<rich:dataTable var="dep" value="#{departmanDao.departmanList}" id="dapartmanInfId"
					onRowMouseOver="this.style.backgroundColor='#F1F1F1'" rows="5"
					onRowMouseOut="this.style.backgroundColor='#{a4jSkin.tableBackgroundColor}'" style=" height : 318px;">
                     
					<f:facet name="header">#{messages['departman.listesi']}
					
				
						<rich:datascroller for="dapartmanInfId"  renderIfSinglePage="true"/>
					
					</f:facet>

					<rich:column style="width:100px;height:100px;">
						<f:facet name="header">#{messages['departman.ad']}</f:facet>
						<h:outputText value="#{dep.departmanAdi}" />
					</rich:column>


					<rich:column style="width:100px;height:100px;">
						<f:facet name="header">#{messages['departman.sorumlusu']}</f:facet>
						<h:outputText value="#{dep.departmanSorumlusu}" />
					</rich:column>

					<rich:column style="width:100px;height:100px;">
						<f:facet name="header">#{messages['departman.dahiliTel']}</f:facet>
						<h:outputText value="#{dep.dahiliTel}" />
					</rich:column>

					<center>
						<rich:column style="width:100px;height:100px;">
							<f:facet name="header">#{messages['departman.durum']}</f:facet>
							<h:outputText value="#{dep.aktif==1?'Aktif':'Pasif'}" />
						</rich:column>
					</center>

					<rich:column style="width:100px;height:100px;">
						<f:facet name="header">#{messages['departman.resim']}</f:facet>

					<h:graphicImage value="#{dep.image}" width="100px" height="100px" />
						



					</rich:column>



					<rich:column
						rendered="#{facesContext.viewRoot.viewId eq '/departmanEkle.xhtml'}"
						style="width:100px;height:100px;">
						<f:facet name="header">#{messages['departman.islem']}</f:facet>

						<a:commandButton value="Pasif" ajaxSingle="true"
							rendered="#{dep.aktif==1}" action="#{departmanDao.pasif(dep)}"
							reRender="departmanReturnValue,departmanPanelList" />

						<a:commandButton value="Aktif" ajaxSingle="true"
							rendered="#{dep.aktif==0}" action="#{departmanDao.aktif(dep)}"
							reRender="departmanReturnValue,departmanPanelList" />



						<a:commandButton ajaxSingle="true" image="/images/icons/edit.gif"
							action="#{departmanDao.departmanGuncel(dep)}"
							reRender="departmanReturnValue,departmanPanelList,departmanGuncelleme"
							oncomplete="Richfaces.showModalPanel('depatmanEditPanel')" />



						<a:commandButton id="silId" value="Sil" ajaxSingle="true"
							eventsQueue="delete" requestDelay="100"
							reRender="departmanReturnValue,departmanPanelList"
							image="/images/icons/delete.gif"
							oncomplete="#{rich:component('deletePanel')}.show()">

							<f:setPropertyActionListener target="#{departmanDao.currentRow}"
								value="#{dep}" />

						</a:commandButton>


					</rich:column>

				</rich:dataTable>
			</rich:panel>

		</a:outputPanel>
	</a:form>

	<rich:modalPanel id="depatmanEditPanel" autosized="true" width="500"
		height="300">

		<f:facet name="header">

			<h:outputText value="#{messages['departman.guncelleme.panel']}"
				style="padding-right:15px;" />


		</f:facet>

		<f:facet name="controls">

			<h:panelGroup>
				<h:graphicImage value="/images/modal/close.png" id="hidelink22" />
				<rich:componentControl for="depatmanEditPanel" attachTo="hidelink22"
					operation="hide" event="onclick" />
			</h:panelGroup>

		</f:facet>

		<a:form ajaxSubmit="true" id="departmanGuncellemeId">

			<a:outputPanel id="departmanGuncelleme">
				<h:panelGrid columns="2">



					<h:outputText value="#{messages['departman.ad']}"
						style="font-weight:bold;" />

					<h:inputText id="panelDepartmanAdi" required="true"
						value="#{departmanDao.departman2.departmanAdi}"
						requiredMessage="#{messages['kisiler.zorunlu']}" />





					<h:outputText value="#{messages['departman.sorumlusu']}"
						style="font-weight:bold;" />

					<h:inputText id="panelDepartmanSorumlusu" required="true"
						value="#{departmanDao.departman2.departmanSorumlusu}"
						requiredMessage="#{messages['kisiler.zorunlu']}" />





					<h:outputText value="#{messages['departman.dahiliTel']}"
						style="font-weight:bold;" />

					<h:panelGroup>
						<h:inputText id="panelDahili" required="true"
							value="#{departmanDao.departman2.dahiliTel}"
							requiredMessage="#{messages['kisiler.zorunlu']}" maxlength="11">
							<rich:beanValidator />
						</h:inputText>
					</h:panelGroup>

				</h:panelGrid>

			</a:outputPanel>
			<a:commandButton action="#{departmanDao.departmanGuncellemeNow()}"
				ajaxSingle="true"
				process="panelDepartmanAdi,panelDepartmanSorumlusu,panelDahili"
				value="Guncelle" reRender="departmanGuncelleme,departmanReturnValue"
				oncomplete="#{rich:component('depatmanEditPanel')}.hide();" />

		</a:form>

	</rich:modalPanel>










	<rich:modalPanel id="deletePanel" autosized="true" width="200">
		<f:facet name="header">
			<h:outputText value="#{messages['sil.onay']}"
				style="padding-right:15px;" />
		</f:facet>
		<f:facet name="controls">
			<h:panelGroup>
				<h:graphicImage value="/images/modal/close.png"
					styleClass="hidelink" id="hidelink2" />
				<rich:componentControl for="deletePanel" attachTo="hidelink2"
					operation="hide" event="onclick" />
			</h:panelGroup>
		</f:facet>
		<a:form ajaxSubmit="true" id="deletePanelSilId">
			<table width="100%">

				<tr>
					<td align="center" width="50%"><a:commandButton
							value="#{messages['departman.onayla']}" ajaxSingle="true"
							action="#{departmanDao.departmanSil()}"
							oncomplete="#{rich:component('deletePanel')}.hide();"
							reRender="departmanReturnValue" /></td>
					<td align="center" width="50%"><a:commandButton
							value="#{messages['departman.vazgec']}"
							onclick="#{rich:component('deletePanel')}.hide();return false;" />
					</td>
				</tr>

			</table>
		</a:form>
	</rich:modalPanel>





</ui:composition>
